package com.pc.service.impl;

import com.pc.enrty.Food;
import com.pc.enrty.Viewed;
import com.pc.mapper.ViewedMapper;
import com.pc.service.ViewedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
@Service
public class ViewedServiceImpl implements ViewedService {
    @Autowired
    private ViewedMapper viewedMapper;
    /**
     * 根据uid查询浏览商品
     * @param viewed
     * @return
     */
    @Override
    public ArrayList<Food> findViewed(Viewed viewed) {
        return viewedMapper.selectViewed(viewed);
    }

    @Override
    public ArrayList<Food> selectByUidAndFid(Viewed viewed) {
        return viewedMapper.selectByUidAndFid(viewed);
    }

    @Override
    public boolean addViewed(Viewed viewed) {
        return viewedMapper.insertViewed(viewed)==1?true:false;
    }

    @Override
    public boolean removeViewed(Viewed viewed) {
        return viewedMapper.deleteViewed(viewed)==1?true:false;
    }
}
